package view.overview;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import view.img.ImageLibrary;

public class OverviewTable extends JScrollPane 
{ private JTable table;
  private DefaultTableModel DTM;
  private final static Dimension size = new Dimension(830,290);
  
  OverviewTable(String[] header)
  { super( );
    Border empty = new EmptyBorder(0,0,0,0);
    this.setBorder(empty);
    this.setSize( size );
    table = new JTable();
    table.setForeground(Color.white);
    table.setBackground(Color.black);
    table.getTableHeader().setBackground(Color.black);
    table.getTableHeader().setForeground(Color.white);
    
    Object[][] data = { { " ", " ", " ", " ", " ", " ", " ", " " } };
    
    DTM = new DefaultTableModel( data, header );
    this.addToTable(header);
    table.setModel(DTM);
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    this.add(table);
    this.setViewportView(table);
    table.getParent().setBackground(Color.BLACK);
  }
  public void addToTable(String[] newData)
  { DTM.insertRow(DTM.getRowCount(), newData); }
  
  public void removeFromTable()
  { DTM.removeRow(1); }
}